import { Component, OnInit, Input, TemplateRef } from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {Location} from '@angular/common'

@Component({
  selector: 'app-device-overview',
  templateUrl: './device-overview.component.html',
  styleUrls: ['./device-overview.component.css']
})
export class DeviceOverviewComponent implements OnInit {
  public id:number;
  @Input() startTime:string=""
  @Input() endTime:string=""
  constructor(
    private activeRoute : ActivatedRoute,
    private location:Location,
    private router: Router
  ){
    this.startTime = activeRoute.snapshot.params['startTime'];
    this.endTime = activeRoute.snapshot.params['endTime'];
    this.id = +activeRoute.snapshot.params['id'];
  }
  navigator(num:number) {
    console.log(num)
    if(num === 1) {
      this.router.navigate(['/pages/performance-analysis/effience-overview'])
    }else if(num === 2) {
      this.router.navigate(['/pages/performance-analysis/alternator-overview/3'])
    }else if(num === 3) {
      this.router.navigate(['/pages/performance-analysis/stability-overview/3'])
    }
  }
  ngOnInit() {
  }
  freshTime(startTime:string){
    let arr = startTime.split(";")
    this.startTime = arr[0];
    this.endTime = arr[1];
  }
  public goBack(flag?:boolean){
    if(flag){
      this.location.back()
    }
    else {
      this.router.navigate(['/pages/home'])
    }
  }
//模态窗

}
